Skip to content

feat!: Upgrade gitlab provider to 19.x - #10

Merged
wiseelf merged 6 commits into
mainfrom
feat/gitlab-provider-19-upgrade
Jul 7, 2026
Merged

feat!: Upgrade gitlab provider to 19.x#10
wiseelf merged 6 commits into
mainfrom
feat/gitlab-provider-19-upgrade

Conversation

@wiseelf

@wiseelf wiseelf commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Bumps the gitlabhq/gitlab provider from 18.4.1 to 19.1.0 per the v19.0 upgrade guide; see docs/UPGRADE-2.0.md for the full breaking-changes list and required terraform state mv commands
  • Renames 7 resources handled automatically via moved.tf (gitlab_project_mirror, 6× gitlab_integration_*)
  • Splits gitlab_branch_protection into CE/EE variants (gated by var.tier) and gitlab_deploy_token into project/group variants — both require a manual terraform state mv (Terraform rejects two moved blocks sharing the same source address)
  • Removes deprecated gitlab_project boolean/mirror attributes (issues_enabled, merge_requests_enabled, wiki_enabled, snippets_enabled, restrict_user_defined_variables, tags, import_url/mirror*), replaced by their *_access_level equivalents, ci_pipeline_variables_minimum_override_role, topics, and a new gitlab_project_pull_mirror resource
  • Migrates gitlab_project_protected_environment to deploy_access_levels_attribute, replaces the deprecated require_password_to_approve with require_reauthentication_to_approve
  • Replaces the unfiltered data "gitlab_users"/data "gitlab_groups" lookups (non-deterministic on large instances — the root cause of the ExactlyOneOf failures) with for_each lookups scoped to only the emails/groups actually referenced in var.gitlab_projects
  • Bumps required_version to >= 1.8.0 everywhere (needed for cross-type moved blocks), including the terragrunt example

Breaking changes

This is a major version bump for module consumers — see docs/UPGRADE-2.0.md for the full list of resource renames/splits and input variable changes, plus manual state migration commands for the two resource splits.

Test plan

  • terraform validate passes on the root module and examples/terraform against the real 19.1.0 provider schema
  • terraform console smoke test confirms the new email/group reference extraction covers all extraction sites (approval rules, memberships, protected environments, share_groups, branch protection)
  • End-to-end terragrunt plan/apply against a real GitLab instance (services-gateway project) to confirm the ExactlyOneOf errors are resolved

wiseelf added 6 commits July 7, 2026 11:59
BREAKING CHANGE: renames gitlab_project_mirror, gitlab_integration_* resources,
splits gitlab_deploy_token into project/group and gitlab_branch_protection into
CE/EE variants, and removes deprecated gitlab_project boolean/mirror attributes
per the provider's 19.0 upgrade guide. See docs/UPGRADE-2.0.md.
Terraform rejects two moved blocks sharing the same 'from' address with
'Ambiguous move statements', so the gitlab_deploy_token and
gitlab_branch_protection splits can't be automated via moved.tf. Keep the
7 safe 1:1 resource renames there, and document the required manual
terraform state mv commands for the two splits in docs/UPGRADE-2.0.md.
… lists

allowed_to_push/allowed_to_merge/allowed_to_unprotect entries only computed
user_id/group_id/deploy_key_id, silently dropping access_level. Since EE no
longer honors push_access_level/merge_access_level at all, callers now rely
on an access_level entry inside allowed_to_push/allowed_to_merge, which the
module previously discarded, producing all-null entries and provider errors.
require_password_to_approve on gitlab_project_level_mr_approvals is
deprecated in provider 19.x and removed in 20.0; use
require_reauthentication_to_approve instead.
data "gitlab_users" "this" {} and data "gitlab_groups" "this" {} paged the
whole instance (720+ users here) and were non-deterministic between two reads
a minute apart, flipping which user/group resolved for allowed_to_push,
allowed_to_merge, membership, approval_rule, and protected_environment
entries and tripping the provider's ExactlyOneOf validator.

Replace both with data.gitlab_user/data.gitlab_group for_each, scoped to only
the emails and group full_paths actually referenced across
var.gitlab_projects. Groups already managed by this module invocation are
merged in directly from gitlab_group.parent_groups/subgroups rather than
looked up externally, since a brand-new group doesn't exist yet at plan time
and would otherwise 404 the data source read. exists_users/exists_groups
keep their existing shape so no other call site changes.
@wiseelf wiseelf self-assigned this Jul 7, 2026
@wiseelf
wiseelf merged commit 38b5a40 into main Jul 7, 2026
4 checks passed
@wiseelf
wiseelf deleted the feat/gitlab-provider-19-upgrade branch July 7, 2026 04:23
github-actions Bot pushed a commit that referenced this pull request Jul 7, 2026
## [2.0.0](v1.4.0...v2.0.0) (2026-07-07)

### ⚠ BREAKING CHANGES

* renames gitlab_project_mirror, gitlab_integration_* resources,
splits gitlab_deploy_token into project/group and gitlab_branch_protection into
CE/EE variants, and removes deprecated gitlab_project boolean/mirror attributes
per the provider's 19.0 upgrade guide. See docs/UPGRADE-2.0.md.

* fix: Bump terragrunt_version_constraint to 0.99.5 in terragrunt example

* fix: Drop ambiguous moved blocks for split resources

Terraform rejects two moved blocks sharing the same 'from' address with
'Ambiguous move statements', so the gitlab_deploy_token and
gitlab_branch_protection splits can't be automated via moved.tf. Keep the
7 safe 1:1 resource renames there, and document the required manual
terraform state mv commands for the two splits in docs/UPGRADE-2.0.md.

* fix: Forward access_level in gitlab_branch_protection ee allowed_to_* lists

allowed_to_push/allowed_to_merge/allowed_to_unprotect entries only computed
user_id/group_id/deploy_key_id, silently dropping access_level. Since EE no
longer honors push_access_level/merge_access_level at all, callers now rely
on an access_level entry inside allowed_to_push/allowed_to_merge, which the
module previously discarded, producing all-null entries and provider errors.

* fix: Replace deprecated require_password_to_approve attribute

require_password_to_approve on gitlab_project_level_mr_approvals is
deprecated in provider 19.x and removed in 20.0; use
require_reauthentication_to_approve instead.

* fix: Replace bulk gitlab_users/gitlab_groups lookups with scoped fetches

data "gitlab_users" "this" {} and data "gitlab_groups" "this" {} paged the
whole instance (720+ users here) and were non-deterministic between two reads
a minute apart, flipping which user/group resolved for allowed_to_push,
allowed_to_merge, membership, approval_rule, and protected_environment
entries and tripping the provider's ExactlyOneOf validator.

Replace both with data.gitlab_user/data.gitlab_group for_each, scoped to only
the emails and group full_paths actually referenced across
var.gitlab_projects. Groups already managed by this module invocation are
merged in directly from gitlab_group.parent_groups/subgroups rather than
looked up externally, since a brand-new group doesn't exist yet at plan time
and would otherwise 404 the data source read. exists_users/exists_groups
keep their existing shape so no other call site changes.

### Features

* Upgrade gitlab provider to 19.x ([#10](#10)) ([38b5a40](38b5a40))
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

This PR is included in version 2.0.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants